package com.xuecheng.content.interfaces.web;

import com.xuecheng.content.application.service.CoursePublishApplication;
import com.xuecheng.content.domain.model.entity.CoursePublish;
import com.xuecheng.content.domain.service.CoursePublishService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;

/**
 * <p>
 * 课程发布 前端控制器
 * </p>
 *
 * @author itcast
 */
@Api(tags = "课程发布接口")
@Slf4j
@RestController
public class CoursePublishApi {

    @Autowired
    private CoursePublishApplication coursePublishApplication;

    @ApiOperation("课程发布")
    @PostMapping("/coursepublish/{courseId}")
    public void coursePublish(@PathVariable Long courseId){
        Long companyId = 1232141425L;
        coursePublishApplication.coursePublish(courseId, companyId);
    }

    @ApiOperation("查询课程发布信息")
    @GetMapping("/r/coursepublish/{courseId}")
    public CoursePublish getCoursepublish(@PathVariable("courseId") Long courseId) {
        CoursePublish coursePublish = coursePublishApplication.getCoursePublish(courseId);
        return coursePublish;
    }
}
